﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ServiceModel.DomainServices.Client;
using System.ServiceModel.DomainServices.Client.ApplicationServices;
using Komunikator.Web.Resources;

namespace Komunikator.Web
{
    public class SearchPeopleInfo : Entity
    {
        private string firstName = String.Empty;
        private string lastName = String.Empty;
        private string sex = String.Empty;
        private int? ageFrom = null;
        private int? ageTo = null;
        private string country = String.Empty;
        private string city = String.Empty;
        private string street = String.Empty;

        [Display(Name="FirstNameLabel", ResourceType=typeof(SearchFormResources))]
        public string FirstName
        {
            get
            {
                return this.firstName;
            }
            
            set
            {
                if (this.firstName != value)
                {
                    this.firstName = value;
                    this.RaisePropertyChanged("FirstName");
                }
            }
        }

        [Display(Name = "LastNameLabel", ResourceType = typeof(SearchFormResources))]
        public string LastName
        {
            get
            {
                return this.lastName;
            }
            
            set
            {
                if (this.lastName != value)
                {
                    this.lastName = value;
                    this.RaisePropertyChanged("LastName");
                }
            }
        }

        [Display(Name = "SexLabel", ResourceType = typeof(SearchFormResources))]
        public string Sex
        {
            get
            {
                return this.sex;
            }
            set
            {
                if (this.sex != value)
                {
                    this.sex = value;
                    this.RaisePropertyChanged("Sex");
                }
            }
        }

        [Display(Name = "AgeFromLabel", ResourceType = typeof(SearchFormResources))]
        [Range(1, 150, ErrorMessageResourceName = "AgeRangeError", ErrorMessageResourceType=typeof(SearchFormResources))]
        public int? AgeFrom
        {
            get
            {
                return this.ageFrom;
            }
            set
            {
                if (this.ageFrom != value)
                {
                    this.ValidateProperty("AgeFrom", value);
                    this.ageFrom = value;
                    this.RaisePropertyChanged("AgeFrom");
                }
            }
        }
        
        [Display(Name = "AgeToLabel", ResourceType = typeof(SearchFormResources))]
        [Range(1, 150, ErrorMessageResourceName = "AgeRangeError", ErrorMessageResourceType = typeof(SearchFormResources))]
        public int? AgeTo
        {
            get
            {
                return this.ageTo;
            }
            set
            {
                if (this.ageTo != value)
                {
                    this.ValidateProperty("AgeTo", value);
                    this.ageTo = value;
                    this.RaisePropertyChanged("AgeTo");
                }
            }
        }

        [Display(Name = "CountryLabel", ResourceType = typeof(SearchFormResources))]
        public string Country
        {
            get
            {
                return this.country;
            }
            set
            {
                if (this.country != value)
                {
                    this.country = value;
                    this.RaisePropertyChanged("Country");
                }
            }
        }

        [Display(Name = "CityLabel", ResourceType = typeof(SearchFormResources))]
        public string City
        {
            get
            {
                return this.city;
            }
            set
            {
                if (this.city != value)
                {
                    this.city = value;
                    this.RaisePropertyChanged("City");
                }
            }
        }

        [Display(Name = "StreetLabel", ResourceType = typeof(SearchFormResources))]
        public string Street
        {
            get
            {
                return this.street;
            }
            set
            {
                if (this.street != value)
                {
                    this.street = value;
                    this.RaisePropertyChanged("Street");
                }
            }
        }

    }
}